package com.jeesite.modules.information.web;

import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.config.Global;
import com.jeesite.common.entity.Page;
import com.jeesite.common.lang.DateUtils;
import com.jeesite.common.utils.excel.ExcelExport;
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.information.entity.CereShopOrder;
import com.jeesite.modules.information.service.CereShopOrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 日常体征Controller
 * @author laz
 * @version 2024-05-09
 */
@Controller
@RequestMapping(value = "${adminPath}/information/historyOrders")
public class HistoryOrdersController extends BaseController {

	@Autowired
	private CereShopOrderService cereShopOrderService;
	
	/**
	 * 获取数据
	 */
	@ModelAttribute
	public CereShopOrder get(String tid, boolean isNewRecord) {
		return cereShopOrderService.get(tid, isNewRecord);
	}
	
	/**
	 * 查询列表
	 */
	@RequiresPermissions("information:historyOrders:view")
	@RequestMapping(value = {"list", ""})
	public String list(CereShopOrder cereShopOrder, Model model) {
		model.addAttribute("cereShopOrder", cereShopOrder);
		return "modules/information/historyOrdersList";
	}
	
	/**
	 * 查询列表数据
	 */
	@RequiresPermissions("information:historyOrders:view")
	@RequestMapping(value = "listData")
	@ResponseBody
	public Page<CereShopOrder> listData(CereShopOrder cereShopOrder, HttpServletRequest request, HttpServletResponse response) {
		cereShopOrder.setPage(new Page<>(request, response));
		Page<CereShopOrder> page = cereShopOrderService.findPage(cereShopOrder);
		return page;
	}

	/**
	 * 查看编辑表单
	 */
	@RequiresPermissions("information:historyOrders:view")
	@RequestMapping(value = "form")
	public String form(CereShopOrder cereShopOrder, Model model) {
		model.addAttribute("cereShopOrder", cereShopOrder);
		return "modules/information/historyOrdersForm";
	}

	// /**
	//  * cereShopOrder 体征记录
	//  * @param cereShopOrder
	//  * @return
	//  */
	// @RequiresPermissions("information:historyOrders:edit")
	// @RequestMapping(value = "insertHistoryOrders")
	// @ResponseBody
	// public String insertCereShopOrder(List<CereShopOrder> cereShopOrder) {
	// 	Integer count = cereShopOrderService.insertBatch(cereShopOrder);
	// 	return renderResult(Global.TRUE, text("拉取日常体征成功！更新"+ count + "条体征记录"));
	// }
	
}